// executors/executor_GitHubStar.js (放在 executors 目录下)

/**
 * 针对 GitHub Search 页面的业务逻辑实现。
 * @param {object} rule - 触发该执行器的规则对象
 */
export async function execute(rule) {
    console.log(`[Executor] Running logic for rule: ${rule.name}`);

    // 具体的 DOM 操作、数据抓取、或事件监听逻辑
    const starForms = document.querySelectorAll('form.js-social-form[method="post"]');

    if (starForms && starForms.length != 0) {
        for (let starForm of starForms){
            const button = starForm.querySelector('button[aria-label]');

            if (button) {
                // 执行美化/自动化操作
                button.style.backgroundColor = '#90ee90';
                button.style.color = 'darkgreen';
                button.style.fontWeight = 'bold';
                button.style.border = '2px solid darkgreen';
                button.textContent = '★ RuleActed! ★';
                console.log("GitHub Star button successfully RuleActed!");
            }
        }

    } else {
        console.warn("Star button form not found on this page.");
    }
}